 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="conversation.css" rel="STYLESHEET" type="text/css">
<title>Browse Message</title>
  <script>
  
  </script>
</head>
<body>
<!--        Header         -->
<jsp:include page="scripts/headerAnnotate.jsp">
  <jsp:param name="title" value="Browse Message" />
</jsp:include>
<jsp:include page="scripts/toggleLayer.js" />
<jsp:include page="scripts/highlight_message.jsp" />
<jsp:include page="scripts/confirm.js" />
<!--       Navigation        -->
<jsp:include page="scripts/mnavigation.jsp">
  <jsp:param name="action" value="browse" />
</jsp:include>
<!--        Metadata         -->
<div>
<table>
  <tr>
    <th width="150">Data Set ID</th>
    <td><c:out value="${message.conversation.dataset.datasetId}" /></td>
    <th>Conversation ID</th>
    <td><c:out value="${message.conversation.conversationId}" /></td>
    <th>Message ID</th>
    <td><c:out value="${message.messageId}" /></td>
  </tr>
  <tr>
    <th>Sequence</th>
    <td><c:out value="${message.sequence}" /></td>
    <th>Speaker</th>
    <td><c:if test="${message.speaker==1}">Librarian</c:if><c:if test="${message.speaker==2}">User</c:if> </td>
    <th>Type</th>
    <td><c:out value="${message.type}" /></td>
  </tr>
  <tr>
    <th>Date Time</th>
    <td colspan="5"><c:out value="${message.dateTime}" /></td>
  </tr>
  <tr>
    <th>Content</th>
    <td id="messageContent" colspan="5"><c:out escapeXml="false"
      value="${message.contentString}" /></td>
  </tr>
  <tr>
    <th>Note</th>
    <td colspan="5">
      <c:out value="${message.note}" />
    </td>    
  </tr>
  <tr>
    <th>Agreement</th>
    <td colspan="5">
		  <c:out value="${message.agreementString}" />
    </td>    
  </tr>
  <tr>
    <th>Annotation</th>
    <td colspan="5">
	  <!--  Begin table for all the annotators -->
  	  <table>
			  <c:forEach items="${message.sortedDialogueActs}" var="da" varStatus="status">			  
	 			  <tr>
	 			  	<td><c:out value="${da.user.userName}"></c:out> (<a name="da<c:out value='${da.dialogueActId}' />"><c:out value="${da.dialogueActId}" /></a>)</td>
	 			    <td>
              <table class="inner" onMouseOver="updateMessage(<c:out value='${status.index}'/>, 'none')">
        				<tr>
	                <th>Text Segment</th>
			            <td colspan="4"><c:out value="${da.textSegment}" /></td>
				        </tr>
				        <tr>
				          <th>Dialogue Act</th>
				          <td>Function:</td>
					        <td><c:out value="${da.function.label}"></c:out></td>
					        <td>Domain:</td>						
					        <td><c:out value="${da.domain.label}"></c:out></td> 												
                </tr>
				        <c:if test="${da.adjacency != null && da.adjacency.adjacencyId != 8}">
				        <tr>
					        <th>Adjacency</th>
					        <td>Relationship:</td>						
						      <td><c:out value="${da.adjacency.label}"></c:out></td>
			            <td>To:</td>						
				          <td><c:out value="${adjacentDialogueAct.textSegment}"></c:out></td>										
				        </tr>
				        </c:if>
				        <% //  c:forEach items="${da.matchedDialogueActs}" var="matched" %>
				        <tr>
				        	<th>Matched with</th>
				        	<td colspan="4"><c:out value="${da.matchedDialogueActsString}" escapeXml="false" /> </td>
				        </tr>
				        <tr>
				        	<th>Exactly Matched with</th>
				        	<td colspan="4"><c:out value="${da.exactlyMatchedDialogueActsString}" escapeXml="false" /> </td>
				        </tr>
				        <% // /c:forEach %>
			        </table>
			      </td>			      
			    </tr>
  	    </c:forEach> 
			  </table>		
			<!--  End the table for all the annotators  -->	
	  </td>
  </tr>
  <tr>
    <td colspan="7">
      <input type="submit" value="Save" /> 
	</td>
	</tr>
	</table>
</div>
<jsp:include page="scripts/footer.jsp" />
</body>
</html>
